package com.example.musicrunner;

import com.example.musicrunner.client.WebKitActivity;

import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;

public class ChangeActivity extends Activity {
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_change);
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
		setupMP3Button();
		setupMessageButton();
		setupWebButton();
		setupBackButton();
	}

	private void setupBackButton() {
		ImageButton button = (ImageButton) findViewById(R.id.btnd);
		button.setOnClickListener(new OnClickListener() {
		   @Override
		   public void onClick(View v) {
			  // finish();
	          startActivity(new Intent(ChangeActivity.this, MainActivity.class));	   
		 }
		});
	   }
	
	private void setupMP3Button() {
		Button button = (Button) findViewById(R.id.btnPlayMusic);
		button.setOnClickListener(new OnClickListener() {
		   @Override
		   public void onClick(View v) {
			   //finish();
            startActivity(new Intent(ChangeActivity.this, MusicPlayerActivity.class));	   
		 }
		});
	   }
	
	
	private void setupMessageButton() {
	Button button = (Button) findViewById(R.id.btnDisplayMessage);
	button.setOnClickListener(new OnClickListener() {
	   @Override
	   public void onClick(View v) {
		   
		   startActivity(new Intent(ChangeActivity.this, LocationMapActivity.class));	   
	 }
	});
   }
			
	private void setupWebButton() {
		ImageButton button = (ImageButton) findViewById(R.id.btnOpenBrowser);
		button.setOnClickListener(new OnClickListener() {
		   @Override
		   public void onClick(View v) {
			
			   startActivity(new Intent(ChangeActivity.this, WebKitActivity.class));	   
		 }
		});
	   }
		
    @Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.change, menu);
		return true;
	}
}



